<?php
/**
 * FileName: BusinessSettingForm.php
 * Author: 790213952@qq.com
 * DateTime: 2024/8/26 下午7:25
 * SystemName: ym-admin
 *
 */

/**
 * FileName: SystemSettingBasicForm.php
 * Author: 790213952@qq.com
 * DateTime: 2024/8/7 下午12:34
 * SystemName: Ymtc
 *
 */


/**
 * FileName: SiteConfig.php
 * Author: Xiao Yao <790213952@qq.com>
 * DateTime: 2022-09-15 下午 02:23
 * Summary:
 */


namespace YmPhp\Admin\Http\Forms;


use YmPhp\Admin\Models\Setting as SystemSettingModel;
use YmPhp\Admin\Widgets\Form;

class BusinessSettingForm extends Form
{
    /**
     * The form title.
     *
     * @var string
     */
    public $title = '基本设置';

    /**
     * Handle the form request.
     *
     * @param Request $request
     *
     */
    public function handle(array $input)
    {
        (new SystemSettingModel())->saveConfig($input, 'system_business');
        return $this->response()->success('保存成功')->refresh();
    }

    /**
     * Build a form here.
     */
    public function form()
    {

        $this->tab(trans('business-list.setting_name'), function () {
            $this->text('business_name', trans('business-list.business_name'));
            $this->text('business_shangquan',trans('business-list.business_shangquan'))->help('填写后，入驻时会显示商圈选项。如不需要请留空。格式：商圈1 商圈2 商圈3');
            $this->radio('business_ruzhu_shenhe',trans('business-list.business_ruzhu_shenhe'))->options([
                '1'=>trans('business-list.open'),
                '2'=>trans('business-list.close')])
                ->default(1);
            $this->radio('business_fenzhan_switch',trans('business-list.business_fenzhan_switch'))->options([
                '1'=>trans('business-list.open'),
                '2'=>trans('business-list.close')])
                ->default(1);
            $this->radio('business_ruzhu_fenzhan',trans('business-list.business_ruzhu_fenzhan'))->options([
                '1'=>trans('business-list.open'),
                '2'=>trans('business-list.close')])
                ->default(1);

            $this->radio('business_list_style',trans('business-list.business_list_style'))->options([
                '1'=>trans('business-list.open'),
                '2'=>trans('business-list.close')])
                ->default(1);
            //置顶优先级
            $this->select('business_zhiding', trans('business-list.business_zhiding'))
                ->options([
//                    '0'=>   __('business-list.close'),
//                    '1'=>   __('business-list.open'),
                    '0' =>  __('business-list.business_zhiding_zong'),
                    '1' =>  __('business-list.business_zhiding_wan_kaishi'),
                    '2' =>  __('business-list.business_zhiding_wan_jieshu'),
                    '3' =>  __('business-list.business_zhiding_shengyu'),
                    '4' =>  __('business-list.business_zhiding_gengxin')])
                ->default('1');

            $this->color('business_tuijian_color',trans('business-list.business_tuijian_color'))->default('#3275fa');

            $this->radio('business_virtually_exposure',trans('business-list.business_virtually_exposure'))
                ->options([
                    '1'=>trans('business-list.open'),
                    '2'=>trans('business-list.close')])
                ->default(1);
            $this->radio('business_virtually_share',trans('business-list.business_virtually_share'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_calculation_views',trans('business-list.business_calculation_views'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_red_follow',trans('business-list.business_red_follow'))->options(['m' => '是', 'f'=> '否'])->default('m');

            $this->radio('business_virtually',trans('business-list.business_virtually'))
                ->options([
                    '1'=>trans('business-list.open'),
                    '2'=>trans('business-list.close')])
                ->default(1);
            $this->radio('business_expired_performance',trans('business-list.business_expired_performance'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->text('business_expired_phone_charges',trans('business-list.business_expired_phone_charges'));

            $this->image('business_default_logo',trans('business-list.business_default_logo'))->autoUpload();
            $this->text('business_max_number_images',trans('business-list.business_max_number_images'));
            $this->radio('business_close_comment',trans('business-list.business_close_comment'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_call_pay',trans('business-list.business_call_pay'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->text('business_infohome_number',trans('business-list.business_infohome_number'));
            $this->radio('business_automatic_scrolling',trans('business-list.business_automatic_scrolling'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_home_merchant_types',trans('business-list.business_home_merchant_types'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_Home_displays_merchants',trans('business-list.business_Home_displays_merchants'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_info_displays_merchants',trans('business-list.business_info_displays_merchants'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_new_style',trans('business-list.business_new_style'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->text('business_photo_albums',trans('business-list.business_photo_albums'));
            $this->text('business_version_introduction',trans('business-list.business_version_introduction'));
            $this->radio('business_required_qrcode',trans('business-list.business_required_qrcode'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->text('business_custom_link_quantity',trans('business-list.business_custom_link_quantity'));
            $this->text('business_number_tags',trans('business-list.business_number_tags'));
            $this->radio('business_same_name_detection',trans('business-list.business_same_name_detection'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_district_select',trans('business-list.business_district_select'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_display_products',trans('business-list.business_display_products'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->text('business_max_number_ruzhu',trans('business-list.business_max_number_ruzhu'));
            $this->text('business_max_select_fenzhan',trans('business-list.business_max_select_fenzhan'));
            $this->text('business_max_hangye',trans('business-list.business_max_hangye'));
            $this->text('business_hours',trans('business-list.business_hours'));
            $this->text('business_scale_number_people',trans('business-list.business_scale_number_people'));
            $this->radio('business_display_fenzhan_merchants',trans('business-list.business_display_fenzhan_merchants'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_display_dial_button',trans('business-list.business_display_dial_button'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_display_district_select',trans('business-list.business_display_district_select'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_display_merchants_map',trans('business-list.business_display_merchants_map'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_map_zoom_level',trans('business-list.business_map_zoom_level'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_secondary_navigation',trans('business-list.business_secondary_navigation'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_display_ruzhu_years',trans('business-list.business_display_ruzhu_years'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_float_qrcode',trans('business-list.business_float_qrcode'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_vr_height',trans('business-list.business_vr_height'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_details_album_images',trans('business-list.business_details_album_images'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_display_top_image',trans('business-list.business_display_top_image'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_top_image_virtualization',trans('business-list.business_top_image_virtualization'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_top_carousel',trans('business-list.business_top_carousel'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_top_carousel_height',trans('business-list.business_top_carousel_height'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_top_waves',trans('business-list.business_top_waves'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_number_coupons',trans('business-list.business_number_coupons'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_number_qianggou',trans('business-list.business_number_qianggou'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_number_jianjia',trans('business-list.business_number_jianjia'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_new_trends',trans('business-list.business_new_trends'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_number_pingtuan',trans('business-list.business_number_pingtuan'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_number_mall',trans('business-list.business_number_mall'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_number_heika',trans('business-list.business_number_heika'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_number_job',trans('business-list.business_number_job'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_number_activity',trans('business-list.business_number_activity'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_custom_chat',trans('business-list.business_custom_chat'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_display_button',trans('business-list.business_display_button'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_open_video',trans('business-list.business_open_video'))->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->radio('business_display_ranking',trans('business-list.business_display_ranking'))->options(['m' => '是', 'f'=> '否'])->default('m');
        });
        $this->tab('上传类配置',function (){
            //模块LOGO
            $this->image('business_logo',trans('business-list.business_logo'))
                ->autoUpload();
            //默认分享图片
            $this->image('business_share_pic',trans('business-list.business_share_pic'))
                ->autoUpload();
        });
        $this->tab('首页配置',function (){
            //头条文字
            $this->text('business_toutiao_text',trans('business-list.business_toutiao_text'));
            //搜索预置词
            $this->text('business_search',trans('business-list.business_search'));
            //标题
            $this->text('business_title',trans('business-list.business_title'));
            //描述
            $this->text('business_description',trans('business-list.business_description'));
            //默认展示
            $this->select('business_default_display',trans('business-list.business_default_display'))
                ->options([
                    '0' =>  trans('business-list.business_default_display_top'),
                    '1' =>  trans('business-list.business_default_display_tuijian'),
                    '2' =>  trans('business-list.business_default_display_new'),
                    '3' =>  trans('business-list.business_default_display_fujin'),
                    '4' =>  trans('business-list.business_default_display_dianping')])
                ->default('1');
            $this->select('business_search_style',trans('business-list.business_search_style'))
                ->options([
                    '0' =>  trans('business-list.business_search_style_default'),
                    '1' =>  trans('business-list.business_search_style_qianru'),
                    '2' =>  trans('business-list.business_search_style_tuchu')])
                ->default('1');
            $this->radio('business_display_dianping',trans('business-list.business_display_dianping'))
                ->options([
                    '1'=>trans('business-list.open'),
                    '2'=>trans('business-list.close')])
                ->default(1);
            $this->radio('business_display_map',trans('business-list.business_display_map'))->options([
                '1'=>trans('business-list.open'),
                '2'=>trans('business-list.close')])
                ->default(1);
            $this->radio('business_map_scale_grade',trans('business-list.business_map_scale_grade'))
                ->options([
                    '1'=>trans('business-list.open'),
                    '2'=>trans('business-list.close')])
                ->default(1);
            $this->radio('business_number_icons',trans('business-list.business_number_icons'))
                ->options([
                    '1'=>trans('business-list.open'),
                    '2'=>trans('business-list.close')])
                ->default(1);

            $this->radio('business_display_trade_screen',trans('business-list.business_display_trade_screen'))
                ->options([
                    '1'=>trans('business-list.open'),
                    '2'=>trans('business-list.close')])
                ->default(1);
            $this->radio('business_icons_line',trans('business-list.business_icons_line'))
                ->options([
                    '1'=>trans('business-list.open'),
                    '2'=>trans('business-list.close')])
                ->default(1);

        });

        $this->tab('商家配置',function (){
            $this->select('business_display_expired_merchants',trans('business-list.business_display_expired_merchants'))
                ->options([
                    '0' =>  trans('business-list.business_expired_performance_wu'),
                    '1' =>  trans('business-list.business_expired_performance_no'),
                    '2' =>  trans('business-list.business_expired_performance_pay'),
                    '3' =>  trans('business-list.business_expired_performance_heika')])
                ->default('1');
            $this->select('business_delivery_method',trans('business-list.business_delivery_method'))
                ->options([
                    '0' =>  trans('business-list.business_delivery_method_province'),
                    '1' =>  trans('business-list.business_delivery_method_county'),
                    '2' =>  trans('business-list.business_delivery_method_city'),
                    '3' =>  trans('business-list.business_delivery_method_hand')])
                ->default('1');
            $this->radio('business_expired_notice',trans('business-list.business_expired_notice'))
                ->options(['m' => '是', 'f'=> '否'])->default('m');
            $this->text('business_notice_template',trans('business-list.business_notice_template'));
        });
        $this->tab('评论配置',function (){
            //模块LOGO
            $this->image('business_logo',trans('business-list.business_logo'))
                ->autoUpload();
            //默认分享图片
            $this->image('business_share_pic',trans('business-list.business_share_pic'))
                ->autoUpload();
        });
        $this->tab('组合配置',function (){
            //模块LOGO
            $this->image('business_logo',trans('business-list.business_logo'))
                ->autoUpload();
            //默认分享图片
            $this->image('business_share_pic',trans('business-list.business_share_pic'))
                ->autoUpload();
        });
        $this->tab('入驻配置',function (){
            //模块LOGO
            $this->image('business_logo',trans('business-list.business_logo'))
                ->autoUpload();
            //默认分享图片
            $this->image('business_share_pic',trans('business-list.business_share_pic'))
                ->autoUpload();
        });
        $this->tab('列表配置',function (){
            //模块LOGO
            $this->image('business_logo',trans('business-list.business_logo'))
                ->autoUpload();
            //默认分享图片
            $this->image('business_share_pic',trans('business-list.business_share_pic'))
                ->autoUpload();
        });
        $this->tab('详情配置',function (){
            //模块LOGO
            $this->image('business_logo',trans('business-list.business_logo'))
                ->autoUpload();
            //默认分享图片
            $this->image('business_share_pic',trans('business-list.business_share_pic'))
                ->autoUpload();
        });
    }

    /**
     * The data of the form.
     *
     * @return array $data
     */
    public function data()
    {
        $datas = SystemSettingModel::pluck('value', 'key');
        return $datas['system_business'];
    }


}



